import 'dart:io';
import 'dart:isolate';

void main() {
  var mainReceiver = ReceivePort();
  Isolate.spawn(newIsolate, mainReceiver.sendPort);
  mainReceiver.listen((message) {
    if (message is SendPort) {
      message.send("main message: mainReceiver message");
    } else {
      print(message);
    }
  });
  mainReceiver.sendPort.send("11");
  // mainReceiver.close();
}

void newIsolate(SendPort sendPort) {
  var receiver = ReceivePort();
  receiver.listen((message) {
    print(message);
    sendPort.send("newIsolate message ");
  });
  sendPort.send(receiver.sendPort);
}

void StreamTest() {
  var filePath = r"listen";
  var stream = File(filePath).openRead();
  var listen = stream.listen((event) {});
  listen.onData((data) {});

}
